/**
 * DBConnect.java
 * 
 * author: Zhiqiang Zhu
 * date: Nov/27/2020
 */
package models;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * class DBConnect
 * establish a connection to a certain database.
 */
public class DBConnect {
	// Code database URL
	static final String DB_URL = "jdbc:mysql://www.papademas.net:3307/510labs?autoReconnect=true&useSSL=false&rewriteBatchedStatements=true";
	// Database credentials
	static final String USER = "db510", PASS = "510";

	/**
	 * connect() establishes a connection to the database.
	 * 
	 * @return connection An object Connection with the connection established to
	 *         the certain database.
	 */
	public Connection connect() throws SQLException {
		return DriverManager.getConnection(DB_URL, USER, PASS);
	}
}
